<script>
import BaseAddForm from '../components/baseForm/add';
export default {
    extends: BaseAddForm,
    data () {
        return {}
    },
    mounted () {
        this.values = {
            group_id: this.parentName
        };
    },
    methods: {
        submit: function () {
            const { formName, parentId } = this;
            this.$f.validate((valid) => {
                if (valid) {
                    const formData = this.formatSubmitData(formName, this.$f.formData());
                    this.$x.post('/userinfo/op/save', {
                        data: {
                            ...formData,
                            group_id: parentId
                        }
                    }).then(() => {
                        this.$message.success('新增成功！');
                        this.$emit('listChanged')
                        this.$router.back();
                    });
                }
            });
        }
    }
}
</script>
